<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>登录界面</title>
<link type="text/css" rel="stylesheet" href="../css/login.css" />

<script type="text/javascript">
function redirect(url){
	location = "/networkforum/pages/main.html";
}
document.onkeydown = function(event){
    var event = event||window.event;
    if(event.keyCode==13) {               
    	login2();
    }
}
function checkDefault(){
	var userName = document.getElementById("userName");
	if(userName.value == "管理员用户名"){
		userName.value = "";
	}
}
function login2(){
	var userName = document.getElementById("userName").value;
	var userPassword = document.getElementById("userPassword").value;
	if(userName == "" || userPassword == ""){
		alert("请先输入用户名和密码");
		return;
	}
	var data = [{"name":"userName","value":userName},
	    		{"name":"userPassword","value":userPassword}];
	var myajax = getByAjax();
	myajax.init(data,"get",true);
	myajax.get("/networkforum/main/control_login.do",function(d){
		if(d == "true"){
			location = "/networkforum/forumcontrol/control_main.html";
		}else if(d == "false"){
			alert("用户名密码错误或!");
		}else if(d == "noLevel") {
			alert("对不起，你的用户无此权限!")
		}
	});
	myajax = null;
}
</script>
</head>

<body>
	<div class="login">
		<div class="leftNav loginInner">
			<div class="loginIcon">
			</div>
			<!-- <span onclick="redirect();"><< 返回首页</span> -->
		</div>
		<div class="rightLogin loginInner">
			<h2 class="loginHeader">社区后台登陆</h2>
			<div class="loginMain">
				<div class="userName userInfo">
					<img src="../images/userNameIcon.gif" />
					<input id="userName" onfocus="checkDefault();" type="text" value="管理员用户名" />
				</div>
				<div class="userPassword userInfo">
					<img src="../images/userPasswordIcon.gif" />
					<input id="userPassword" type="password" value="" />
				</div>
				<span class="loginButtom" onclick="login2();">Login</span>
				<span class="welcome">欢迎管理员</span>
			</div>
		</div>
	</div>
</body>
<script src="/networkforum/js/myajax.js" type="text/javascript"></script>
</html>
